<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>


<div id="createWizard" class="wizard box no-border">
	<div class=" header">
		<ul class="steps">
			<li class="current"><a href="#wiz_baseInfo">1、基础信息</a>
			</li>
			<li><a href="#wiz_customer_property">2、自定义属性信息</a>
			</li>
		</ul>
	</div>
	<div style="padding:0" class="content tabbed">
		<div id="wiz_baseInfo">
			<form:form id="categoryForm" commandName="model" cssClass="validate"
				action="configuration/category/save">
				<form:hidden path="id" />
				<table class=" form-table">
					<tbody>
						<tr>
							<td class="td1">父级配置分类：</td>
							<td class="td2"><form:input path="parentId"
									cssClass="hidden" /> <isperp:treeSelector
									id="selectParentName" url="configuration/category/getTree"
									valueControlId="parentId" displayValue="${parentName}"
									displayValueCssClass="required"></isperp:treeSelector></td>
						</tr>
						<tr>
							<td class="td1">名称：</td>
							<td class="td2"><form:input path="name" cssClass="required" />
							</td>
						</tr>

						<tr>
							<td class="td1">资产主体类：</td>
							<td class="td2"　><select id="meta1" name="meta1">

									<option value="0">否</option>
									<option value="1"
										<c:if test="${'1' eq model.meta1 }"> selected="selected"</c:if>>是</option>
							</select></td>
						</tr>
						<tr>
							<td class="td1">是否展开：</td>
							<td class="td2"　><form:checkbox path="open" /></td>
						</tr>
						<tr>
							<td class="td1">排序：</td>
							<td class="td2"　><form:input path="orderNum"
									cssClass="number" />
							</td>
						</tr>
					</tbody>
				</table>

			</form:form>
		</div>

		<div id="wiz_customer_property">

			<isperp:grid
				url="configuration/category/property/listByCategory?categoryId="
				urlExtScript="function(){return $('#id').val();}"
				gridId="categoryPropertyGrid" gridTitle="自定义属性"
				cusFormatterActions="true" showSearchbar="false" showPager="false"
				cusDialogSize="small" cusDialogHeight="520"
				cusEditUrl="configuration/category/property/edit"
				cusDeleteUrl="configuration/category/property/delete"
				ondbClickRowEvent="categoryPropertyGrid.edit(rowid);"
				beforeCreateAction="'categoryId='+$('#id').val()"
				afterActionsSuccess="isperp.reloadParentControlById('categoryPropertyGrid');">

				<jsp:attribute name="toolbar">
	 				<isperp:toolbar id="categoryPropertyToolbar">
		 				<isperp:button id="categoryPropertyCreate" icon="icon-plus"
							text="添加自定义属性" onclick="categoryPropertyGrid.create();"></isperp:button>
	 				</isperp:toolbar>
	 			</jsp:attribute>
				<jsp:body> 
					<isperp:column name="id" title="id" hidden="true"></isperp:column> 
					<isperp:column name="parent_treenode_name_path" title="所属分类"
						width="120">
					</isperp:column>
					<isperp:column name="name" title="属性名称" width="100">
					</isperp:column>
					<isperp:column name="default_value" title="默认值" width="80">
					</isperp:column>
					<isperp:column name="data_type" title="类型" width="70">
					</isperp:column>
					<isperp:column name="notnull" title="必填项" width="50" align="center"
						formatter="checkbox">
					 </isperp:column>
					</jsp:body>

			</isperp:grid>
		</div>
	</div>

	<isperp:wizButtonList buttonListId="wizCreateSetpBtns"
		hiddenFinishButton="false">
	</isperp:wizButtonList>
</div>



<script type="text/javascript">
	var $wizCreate = isperp.wizard({
		wizardId : "createWizard",
		validataStep : true
	});

	function submitCategory() {
		return isperp.submitForm({
			formId : "categoryForm",
			success : function() {
				isperp.reloadParentControl();
				isperp.hideLoading({
					onThisWindow : true
				});
			},
			error : function() {
				isperp.hideLoading({
					onThisWindow : true
				});
			}
		});
	}

	var createWizard_Event1 = function(index, obj) {
		isperp.showLoading({
			onThisWindow : true
		});
		if (!submitCategory()) {
			//isperp.hideLoading();
			return false;
		}
	};

	var createWizard_Event2 = function(index, obj) {

		isperp.closeDialog();
	};
</script>